//
//  MONetWork.h
//  emmoDiary
//
//  Created by miki on 2020/3/18.
//  Copyright © 2020 miki. All rights reserved.
//

#import "AFHTTPSessionManager.h"
//if (api.code == 14032 || api.code == 14033 || api.code == 1500) {    //14032没传token  \  14033 token失效  \ 1500 用户已注销
//    if (api.code == 14033) {
typedef NS_ENUM(NSInteger, NetworkErrorCode) {
    NetworkErrorCode_noToken = 14032,               //缺失token
    NetworkErrorCode_failureToken = 14033,       // token失效
    NetworkErrorCode_destroy = 1500,            // 用户已注销
};
@class MOTXApiModel,EMApiModel;

@interface EMNetWork : AFHTTPSessionManager

+ (EMNetWork *)shareManager;

- (NSURLSessionDataTask *)tx_post:(NSString *)path
                           params:(id)params
                          success:(void(^)(MOTXApiModel *api))success
                             fail:(void(^)(void))fail;

- (NSURLSessionDataTask *)em_post:(NSString *)url
                           params:(NSDictionary *)params
                              hud:(NSString *)hud
                        showError:(BOOL)showError
                          success:(void(^)(EMApiModel *api))success
                             fail:(void(^)(void))fail;

- (void)em_uploadImage:(UIImage *)image
               showHud:(BOOL)showHud
                 isPng:(BOOL)isPng
               success:(void(^)(NSString *fileId))success
                  fail:(void(^)(void))fail;

@end

@interface MOTXApiModel : NSObject

@property (nonatomic ,copy) NSString *msg;

@property (nonatomic) id newslist;

@property (nonatomic) NSInteger code;

@property (nonatomic) BOOL success;

@end

@interface EMApiModel : NSObject

@property (nonatomic ,copy) NSString *msg;
@property (nonatomic) NSInteger code;
@property (nonatomic) id data;
@property (nonatomic) BOOL success;
@property (nonatomic) id orderInfo;

@end
